/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package managedBean.CM;

//import entity.account.AdminACL;
//import entity.account.RepresentativeRoles;
//import entity.account.Representatives;
//import entity.establishment.Stakeholder;
import entity.Outlet;
import entity.Stakeholder;
import entity.StakeholderFood;
import entity.StakeholderPerformance;
import java.io.Serializable;
import java.util.ArrayList;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;
import javax.faces.event.PhaseEvent;
import org.primefaces.component.menuitem.MenuItem;
import org.primefaces.component.submenu.Submenu;
import org.primefaces.model.DefaultMenuModel;
import org.primefaces.model.MenuModel;
import session.TX.OutletSBRemote;
import session.TX.StakeholderAccountSBRemote;
//import session.CM.AccountManagementSBRemote;

/**
 *
 * @author Jasmine
 */
@ManagedBean
@ViewScoped
public class DashboardMB implements Serializable {

    private MenuModel model;
    private Long stakeholderId;
    private String accountType;
    private Long accountId;
    private ArrayList<String> roles = new ArrayList<String>();
    private boolean showDropdownList = false;
//    @EJB
//   private AccountManagementSBRemote accountManagementSB;
    //Use by Tx team
    @EJB
    private StakeholderAccountSBRemote stakeholderManager;
    @EJB
    private OutletSBRemote outletBean;

    public DashboardMB() {
    }//default constructor

//    public void initView(PhaseEvent event) {
//        try {
//            accountType = (String) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("accountType");
//            if (accountType != null) {
//                accountId = Long.valueOf(FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("accountId").toString());
//
//                if (FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("stakeholderId") != null) {
//                    stakeholderId = Long.valueOf(FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("stakeholderId").toString());
//                    stakeholderName = (FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("stakeholderName").toString());
//                    showDropdownList = true;
//                }
//                getAccountRoles();
//                generateDashboard();
//            }
//        } catch (Exception ex) {
//            ex.printStackTrace();
//        }
//    }//initView
//
//    public void getAccountRoles() {
//        /*    if (accountType.compareTo("representative") == 0) {
//        if (stakeholderId != null) {
//        roles = accountManagementSB.getRolesOfRepByStakeholder(accountId, stakeholderId);
//        } else {
//        // first login
//        Representatives rep = accountManagementSB.getRepresentativeAccount(accountId);
//        roles.add(rep.getRepresentativesACL().iterator().next().getRoleName());
//        }
//        } else if (accountType.compareTo("admin") == 0) {
//        roles.clear();
//        Collection<AdminACL> acls = accountManagementSB.retrieveRolesAdmin(accountId);
//        for (AdminACL acl : acls) {
//        roles.add(acl.getRoleName());
//        }
//        } */
//
//        //new code
//        try {
//            if (accountType.compareTo("representative") == 0) {
//                if (stakeholderId != null) {
//                    roles = accountManagementSB.getAllRolesOfRep(accountId);
//                }//end of if
//                else {
//                    // first login
//                    Representatives rep = accountManagementSB.getRepresentativeAccount(accountId);
//                    roles.add(rep.getRepresentativesACL().iterator().next().getRoleName());
//                }//end of else
//            }//end of if
//            else if (accountType.compareTo("admin") == 0) {
//                roles.clear();
//                Collection<AdminACL> acls = accountManagementSB.retrieveRolesAdmin(accountId);
//                for (AdminACL acl : acls) {
//                    roles.add(acl.getRoleName());
//                }//end of for
//            }//end of else if
//        }//end of try
//        catch (Exception ex) {
//        }//end of catch
//
//    }//getAccountRoles
//
//    public ArrayList<SelectItem> retrieveStakeholderList() {
//
//        ArrayList<Stakeholder> stakeholderList = (ArrayList<Stakeholder>) accountManagementSB.getAllStakeholderByAccountId(accountId);
//        ArrayList<SelectItem> resultList = new ArrayList<SelectItem>();
//        resultList.add(new SelectItem(null, "Please Select"));
//        if (!stakeholderList.isEmpty()) {
//            for (Object o : stakeholderList) {
//                Stakeholder stakeholder = (Stakeholder) o;
//                resultList.add(new SelectItem(stakeholder.getId().toString(), stakeholder.getName()));
//            }
//            return resultList;
//        } else {
//            return resultList;
//        }
//    }
//
//    public void stakeholderOnChange() {
//        // To retrieve ACLs
//        ArrayList<RepresentativeRoles> acls = accountManagementSB.retrieveRolesRepAcl(accountId, stakeholderId);
//        Iterator i = acls.iterator();
//        ArrayList url = new ArrayList();
//        while (i.hasNext()) {
//            RepresentativeRoles acl = (RepresentativeRoles) i.next();
//            url.clear();
//            url.add(acl.getUrl());
//        }
//        FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("url", url);
//        FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("stakeholderId", stakeholderId);
//        getAccountRoles();
//        generateDashboard();
//    }
//
//    public void generateDashboard() {
//        model = new DefaultMenuModel();
//        Submenu submenu = new Submenu();
//        MenuItem item = new MenuItem();
//
//        if (accountType.compareTo("admin") == 0) {
//            //First submenu  
//            submenu.setLabel("General");
//            //Update Account Information (Everyone)
//            item.setValue("Update Account Information");
//            item.setUrl("/admin/updateadminaccount.xhtml");
//            submenu.getChildren().add(item);
//
//            item = new MenuItem();
//            item.setValue("Change Password");
//            item.setUrl("/admin/changeadminpassword.xhtml");
//            submenu.getChildren().add(item);
//
//            item = new MenuItem();
//            item.setValue("Send Message");
//            item.setUrl("/admin/sendmessage.xhtml");
//            submenu.getChildren().add(item);
//
//            item = new MenuItem();
//            item.setValue("View Messages");
//            item.setUrl("/admin/viewallmessage.xhtml");
//            submenu.getChildren().add(item);
//
//            item = new MenuItem();
//            item.setValue("View Requests");
//            item.setUrl("/admin/viewallrequest.xhtml");
//            submenu.getChildren().add(item);
//
//            model.addSubmenu(submenu);
//
//            for (String role : roles) {
//
//                // MASTER ADMIN
//                if (role.compareTo("master admin") == 0) {
//                    //Manage Staff (Admin)
//                    submenu = new Submenu();
//                    submenu.setLabel("Master Admin");
//
//                    item = new MenuItem();
//                    item.setValue("Manage Auxillary");
//                    item.setUrl("/admin/manageauxillary.xhtml");
//                    submenu.getChildren().add(item);
//
//                    item = new MenuItem();
//                    item.setValue("Manage Admin Role");
//                    item.setUrl("/admin/adminrolemanagement.xhtml");
//                    submenu.getChildren().add(item);
//
//                    item = new MenuItem();
//                    item.setValue("File Manager");
//                    item.setUrl("/admin/filemanager.xhtml");
//                    submenu.getChildren().add(item);
//
//                    item = new MenuItem();
//                    item.setValue("Manage Admin");
//                    item.setUrl("/admin/manageadmin.xhtml");
//                    submenu.getChildren().add(item);
//
//                    item = new MenuItem();
//                    item.setValue("Manage Category");
//                    item.setUrl("/admin/managecategory.xhtml");
//                    submenu.getChildren().add(item);
//
//                    item = new MenuItem();
//                    item.setValue("Manage Language");
//                    item.setUrl("/admin/managelanguage.xhtml");
//                    submenu.getChildren().add(item);
//
//                    model.addSubmenu(submenu);
//                }
//
//                // ACCOUNT MANAGER
//                if (role.compareTo("account manager") == 0 || role.compareTo("master admin") == 0) {
//                    //Manage User Account (Admin)  
//                    submenu = new Submenu();
//                    submenu.setLabel("Account Manager");
//                    item = new MenuItem();
//                    item.setValue("Manage Member/Stakeholder Account");
//                    item.setUrl("/admin/manageaccountstatus.xhtml");
//                    submenu.getChildren().add(item);
//
//                    model.addSubmenu(submenu);
//                }
//
//                // ITINERARY MANAGER
//                if (role.compareTo("itinerary manager") == 0 || role.compareTo("master admin") == 0) {
//                    //Manage Itineraries (Admin)
//                    submenu = new Submenu();
//                    submenu.setLabel("Itinerary Manager");
//                    item = new MenuItem();
//                    item.setValue("Manage Itinerary");
//                    item.setUrl("/admin/itineraryplanner.xhtml");
//                    submenu.getChildren().add(item);
//
//                    model.addSubmenu(submenu);
//                }
//
//                // DESIGNER
//                if (role.compareTo("designer") == 0 || role.compareTo("master admin") == 0) {
//                    //Manage Site Layout (Admin)
//                    submenu = new Submenu();
//                    submenu.setLabel("Designer");
//
//                    item = new MenuItem();
//                    item.setValue("Manage Homepage");
//                    item.setUrl("/admin/managehomepage.xhtml");
//                    submenu.getChildren().add(item);
//
//                    item = new MenuItem();
//                    item.setValue("Manage Template");
//                    item.setUrl("/admin/managetemplate.xhtml");
//                    submenu.getChildren().add(item);
//                    
//                    item = new MenuItem();
//                    item.setValue("Manage Header Element");
//                    item.setUrl("/admin/manageheaderelement.xhtml");
//                    submenu.getChildren().add(item);
//
//                    item = new MenuItem();
//                    item.setValue("Manage Backend Template");
//                    item.setUrl("/admin/managebackendtemplate.xhtml");
//                    submenu.getChildren().add(item);
//
//                    model.addSubmenu(submenu);
//                }
//
//                //SH MANAGER
//                if (role.compareTo("sh manager") == 0 || role.compareTo("master admin") == 0) {
//                    //Manage Stakeholders (Admin)
//                    submenu = new Submenu();
//                    submenu.setLabel("SH Manager");
//
//                    item = new MenuItem();
//                    item.setValue("Manage Request Approval");
//                    item.setUrl("/admin/approvalmanagement.xhtml");
//                    submenu.getChildren().add(item);
//
//                    item = new MenuItem();
//                    item.setValue("Manage Tag");
//                    item.setUrl("/admin/managetag.xhtml");
//                    submenu.getChildren().add(item);
//
//                    item = new MenuItem();
//                    item.setValue("Manage Stakeholder Content");
//                    item.setUrl("/admin/manageuserupload.xhtml");
//                    submenu.getChildren().add(item);
//
//                    item = new MenuItem();
//                    item.setValue("Manage Stakeholder Page");
//                    item.setUrl("/admin/stakeholderpagemanagement.xhtml");
//                    submenu.getChildren().add(item);
//
//                    model.addSubmenu(submenu);
//                }
//
//                // TMARKETING MANAGER
//                if (role.compareTo("tmarketing manager") == 0 || role.compareTo("master admin") == 0) {
//                    //Manage Adverts (Admin)
//                    submenu = new Submenu();
//                    submenu.setLabel("TMarketing Manager");
//
//                    item = new MenuItem();
//                    item.setValue("Manage Event");
//                    item.setUrl("/admin/manageevent.xhtml");
//                    submenu.getChildren().add(item);
//
//                    item = new MenuItem();
//                    item.setValue("View Web Analytics");
//                    item.setUrl("/admin/webanalytics.xhtml");
//                    submenu.getChildren().add(item);
//
//                    model.addSubmenu(submenu);
//                }
//
//                // ACHIEVEMENT MANAGER
//                if (role.compareTo("achievement manager") == 0 || role.compareTo("master admin") == 0) {
//                    //Manage Adverts (Admin)
//                    submenu = new Submenu();
//                    submenu.setLabel("Achievement Manager");
//
//                    item = new MenuItem();
//                    item.setValue("Manage Achievement");
//                    item.setUrl("/admin/achievementmanagement.xhtml");
//                    submenu.getChildren().add(item);
//
//                    item = new MenuItem();
//                    item.setValue("Manage Request Approval");
//                    item.setUrl("/admin/approvalmanagement.xhtml");
//                    submenu.getChildren().add(item);
//
//                    model.addSubmenu(submenu);
//                }
//            }
//
//        } else if (accountType.compareTo("representative") == 0) {
//            //First submenu  
//            submenu.setLabel("General");
//
//            //Update Account Information (Everyone)
//            item.setValue("Update Account Information");
//            item.setUrl("/stakeholder/updaterepresentativeaccount.xhtml");
//            submenu.getChildren().add(item);
//
//            item = new MenuItem();
//            item.setValue("Change Password");
//            item.setUrl("/stakeholder/changerepresentativepassword.xhtml");
//            submenu.getChildren().add(item);
//
//            //model.addSubmenu(submenu);
//            boolean runOnce = true;
//            for (String role : roles) {
//
//                // NOT - ROOT NOT ACTIVATED
//                if (role.compareTo("rootNotActivated") != 0) {
//                    if (runOnce) {
//                        item = new MenuItem();
//                        item.setValue("Send Message(To Stakeholder)");
//                        item.setUrl("/stakeholder/sendmessage.xhtml");
//                        submenu.getChildren().add(item);
//
//                        item = new MenuItem();
//                        item.setValue("Send Request(To Admin)");
//                        item.setUrl("/stakeholder/sendrequest.xhtml");
//                        submenu.getChildren().add(item);
//
//                        item = new MenuItem();
//                        item.setValue("View Messages");
//                        item.setUrl("/stakeholder/viewallmessage.xhtml");
//                        submenu.getChildren().add(item);
//
//                        item = new MenuItem();
//                        item.setValue("View Requests");
//                        item.setUrl("/stakeholder/viewmyrequest.xhtml");
//                        submenu.getChildren().add(item);
//                        
//                        model.addSubmenu(submenu);
//                        runOnce = false;
//                    }
//                } else {
//                    if (runOnce) {
//                        model.addSubmenu(submenu);
//                        runOnce = false;    // Set the runOnce to false
//                    }
//                }
//
//                // SH ROOT ADMIN
//                if (role.compareTo("shroot admin") == 0) {
//                    //Manage Staff (Stakeholder)
//                    submenu = new Submenu();
//                    submenu.setLabel("SH Root Admin");
//
//                    item = new MenuItem();
//                    item.setValue("Add Representative");
//                    item.setUrl("/stakeholder/addrepadmin.xhtml");
//                    submenu.getChildren().add(item);
//
//                    item = new MenuItem();
//                    item.setValue("Manage Role");
//                    item.setUrl("/stakeholder/reprolemanagement.xhtml");
//                    submenu.getChildren().add(item);
//
//                    model.addSubmenu(submenu);
//                }
//
//                // CONTENT MANAGER
//                if (role.compareTo("content manager") == 0 || role.compareTo("shroot admin") == 0) {
//
//                    //Manage Site Content (Stakeholder)
//                    submenu = new Submenu();
//                    submenu.setLabel("Content Manager");
//
//                    item = new MenuItem();
//                    item.setValue("Manage MicroPortal");
//                    item.setUrl("/stakeholder/managemicroportal.xhtml");
//                    submenu.getChildren().add(item);
//
//                    item = new MenuItem();
//                    item.setValue("Manage Photo");
//                    item.setUrl("/stakeholder/photogallery.xhtml");
//                    submenu.getChildren().add(item);
//
//                    model.addSubmenu(submenu);
//                }
//
//                // SMARKETING MANAGER
//                if (role.compareTo("smarketing manager") == 0 || role.compareTo("shroot admin") == 0) {
//                    //Manage Promotion (Stakeholder)
//                    submenu = new Submenu();
//                    submenu.setLabel("Marketing Manager");
//
//                    item = new MenuItem();
//                    item.setValue("Manage Achievement");
//                    item.setUrl("/stakeholder/achievementmanagement.xhtml");
//                    submenu.getChildren().add(item);
//
//                    item = new MenuItem();
//                    item.setValue("Manage Promotion");
//                    item.setUrl("/stakeholder/managepromotion.xhtml");
//                    submenu.getChildren().add(item);
//
//                    model.addSubmenu(submenu);
//                }
//
//                // ROOT NOT ACTIVATED
//                if (role.compareTo("rootNotActivated") == 0) {
//                    submenu = new Submenu();
//                    submenu.setLabel("Get Started");
//
//                    item = new MenuItem();
//                    item.setValue("Add Establishment & Stakeholder");
//                    item.setUrl("/stakeholder/addentity.xhtml");
//                    submenu.getChildren().add(item);
//
//                    model.addSubmenu(submenu);
//                }
//            }
//
//        } else if (accountType.equals("user")) {
//            //First submenu  
//            submenu.setLabel("General");
//
//            //Update Account Information (Everyone)
//            item.setValue("Update Account Information");
//            item.setUrl("/member/updatememberaccount.xhtml");
//            submenu.getChildren().add(item);
//
//            //Update Account Information (Everyone)
//            item = new MenuItem();
//            item.setValue("Change Password");
//            item.setUrl("/member/changememberpassword.xhtml");
//            submenu.getChildren().add(item);
//
//            item = new MenuItem();
//            item.setValue("View Achievement");
//            item.setUrl("/member/achievementmanagement.xhtml");
//            submenu.getChildren().add(item);
//
//            item = new MenuItem();
//            item.setValue("Claim Your Code");
//            item.setUrl("/member/claimcode.xhtml");
//            submenu.getChildren().add(item);
//
//            item = new MenuItem();
//            item.setValue("My Itinerary");
//            item.setUrl("/member/itineraryplannerlanding.xhtml");
//            submenu.getChildren().add(item);
//
//            item = new MenuItem();
//            item.setValue("View Notifications");
//            item.setUrl("/member/viewnotification.xhtml");
//            submenu.getChildren().add(item);
//
//            item = new MenuItem();
//            item.setValue("Be Tour Guide");
//            item.setUrl("/member/betourguide.xhtml");
//            submenu.getChildren().add(item);
//
//            model.addSubmenu(submenu);
//        }
//    }//generateDashboard
//
    public MenuModel getModel() {
        return model;
    }

    public Long getAccountId() {
        return accountId;
    }

    public void setAccountId(Long accountId) {
        this.accountId = accountId;
    }

    public ArrayList<String> getRoles() {
        return roles;
    }

    public void setRoles(ArrayList<String> roles) {
        this.roles = roles;
    }

    public boolean isShowDropdownList() {
        return showDropdownList;
    }

    public void setShowDropdownList(boolean showDropdownList) {
        this.showDropdownList = showDropdownList;
    }

    public String getAccountType() {
        return accountType;
    }

    public void setAccountType(String accountType) {
        this.accountType = accountType;
    }

    public Long getStakeholderId() {
        return stakeholderId;
    }

    public void setStakeholderId(Long stakeholderId) {
        this.stakeholderId = stakeholderId;
    }

    //===================================================================================================================================
    //===================================================================================================================================   
    //TRANSACTION TEAM CODE
    private String stakeholderName;
    private MenuModel outletManagerModel;
    
    public MenuModel getOutletManagerModel() {
        return outletManagerModel;
    }

    public String getStakeholderName() {
        return stakeholderName;
    }

    public void setStakeholderName(String stakeholderName) {
        this.stakeholderName = stakeholderName;
    }

    public void initView(PhaseEvent event) {
        try {
            accountType = (String) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("accountType");
            if (accountType != null) {
                accountId = Long.valueOf(FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("accountId").toString());

                if (FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("stakeholderId") != null) {
                    stakeholderId = Long.valueOf(FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("stakeholderId").toString());
                    stakeholderName = (FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("stakeholderName").toString());
                    showDropdownList = true;
                }
                //getAccountRoles();
                generateDashboard();
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }//initView

    public void generateDashboard() {
        model = new DefaultMenuModel();
        outletManagerModel = new DefaultMenuModel();
        Submenu submenu = new Submenu();
        MenuItem item = new MenuItem();

        //Tx Team TCube Admin Navigation Links
        if (accountType.compareTo("admin") == 0) {
            System.out.println(">>> DashboardMB: Generating Dashboard for TCube Admin");

            //SABM
            submenu.setLabel("Stakeholder Management");

            item = new MenuItem();
            item.setValue("Stakeholder Categories");
            item.setUrl("/admin/stakeholdercategories.xhtml");
            submenu.getChildren().add(item);

            item = new MenuItem();
            item.setValue("Stakeholders");
            item.setUrl("/admin/stakeholdersmanagement.xhtml");
            submenu.getChildren().add(item);

            item = new MenuItem();
            item.setValue("Stakeholder Billing");
            item.setUrl("/admin/stakeholderbilling.xhtml");
            submenu.getChildren().add(item);
            
            item = new MenuItem();
            item.setValue("Stakeholder/Customer Loyalty Points");
            item.setUrl("/admin/editloyaltypoints.xhtml");
            submenu.getChildren().add(item);
            
            item = new MenuItem();
            item.setValue("Delete Advertisement");
            item.setUrl("../admin/deleteadvertisement.xhtml");
            submenu.getChildren().add(item);

            model.addSubmenu(submenu);

            //Stakeholder Tier Management
            submenu = new Submenu();
            submenu.setLabel("Stakeholder Tier System");
            item = new MenuItem();
            item.setValue("Add/Delete Tier");
            item.setUrl("/admin/createnewtier.xhtml");
            submenu.getChildren().add(item);

            item = new MenuItem();
            item.setValue("Modify Tier");
            item.setUrl("/admin/modifytier.xhtml");
            submenu.getChildren().add(item);

            item = new MenuItem();
            item.setValue("Change Stakeholder Tier");
            item.setUrl("/admin/changestakeholdertier.xhtml");
            submenu.getChildren().add(item);

            model.addSubmenu(submenu);
            
            //Stakeholder LuckyDraw
            submenu = new Submenu();
            submenu.setLabel("Stakeholder Lucky Draw System");
            
            item = new MenuItem();
            item.setValue("Generate Lucky Draw");
            item.setUrl("/admin/luckydraw.xhtml");
            submenu.getChildren().add(item);
            
            model.addSubmenu(submenu);
            //end

            submenu = new Submenu();
            submenu.setLabel("Stakeholder IOTR Monitoring & Management");

            item = new MenuItem();
            item.setValue("Outlet Reservation Settings");
            item.setUrl("/admin/displayReservationSettings.xhtml");
            submenu.getChildren().add(item);

            item = new MenuItem();
            item.setValue("Display Customer Reservations");
            item.setUrl("/admin/displayReservations.xhtml");
            submenu.getChildren().add(item);

            item = new MenuItem();
            item.setValue("Manage Outlet Dishes");
            item.setUrl("/admin/manageOutletFoodItems.xhtml");
            submenu.getChildren().add(item);

            item = new MenuItem();
            item.setValue("Manage Group Deal Proposals");
            item.setUrl("/admin/manageGroupBuyingItems.xhtml");
            submenu.getChildren().add(item);

            model.addSubmenu(submenu);
            
            
            //Venue management for performances
            submenu = new Submenu();
            submenu.setLabel("Performance Venue Management");
            
            item = new MenuItem();
            item.setValue("Add Venue");
            item.setUrl("/admin/addvenue.xhtml");
            submenu.getChildren().add(item);
            
            item = new MenuItem();
            item.setValue("Delete Venue");
            item.setUrl("/admin/deletevenue.xhtml");
            submenu.getChildren().add(item);
            
            item = new MenuItem();
            item.setValue("Modify Venue");
            item.setUrl("/admin/modifyvenue.xhtml");
            submenu.getChildren().add(item);
            
            item = new MenuItem();
            item.setValue("Delete Layout");
            item.setUrl("/admin/deletevenuelayout.xhtml");
            submenu.getChildren().add(item);
            
            model.addSubmenu(submenu);
            
            
            
            //TTA
            submenu = new Submenu();
            submenu.setLabel("Analytics");
                
            item = new MenuItem();
            item.setValue("FoodSage Transaction Analytics");
            item.setUrl("/admin/TTA/home.xhtml");
            submenu.getChildren().add(item);

            model.addSubmenu(submenu);

        }

        //---------------------------------------------------------------------------------------------------------------------------------------------------------
        //---------------------------------------------------------------------------------------------------------------------------------------------------------

        //Tx Team Stakeholder Representative Navigation Links
        if (accountType.compareTo("representative") == 0) {

            System.out.println(">>> DashboardMB: Generating Dashboard for Stakeholder Representative");
            stakeholderName = FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("stakeholderName").toString();
            Stakeholder stkhldr = stakeholderManager.findStakeholderByName(stakeholderName);
            
                //GENERAL MENU FOR ALL STAKEHOLDER ROOT ADMINS
 
                            //Rewards management submenu for stakeholders
                            submenu = new Submenu();
                            submenu.setLabel("Loyalty Program");

                            item = new MenuItem();
                            item.setValue("Loyalty Points Manager");
                            item.setUrl("/stakeholder/pointsmanager.xhtml");
                            submenu.getChildren().add(item);


                            item = new MenuItem();
                            item.setValue("Rewards Manager");
                            item.setUrl("/stakeholder/rewardsmanager.xhtml");
                            submenu.getChildren().add(item);

                            model.addSubmenu(submenu);


                            //Advertisement management submenu for stakeholders
                            submenu = new Submenu();
                            submenu.setLabel("Advertisements");

                            item = new MenuItem();
                            item.setValue("Create Ad");
                            item.setUrl("/stakeholder/advertisementmanager.xhtml");
                            submenu.getChildren().add(item);
                            
                            item = new MenuItem();
                            item.setValue("View Ad");
                            item.setUrl("../stakeholder/viewadvertisement.xhtml");
                            submenu.getChildren().add(item);

                            model.addSubmenu(submenu);

                            //Group Buying item
                            submenu = new Submenu();
                            submenu.setLabel("Group Deals");

                            item = new MenuItem();
                            item.setValue("Add Group Deal");
                            item.setUrl("/stakeholder/addNewProposal.xhtml");
                            submenu.getChildren().add(item);

                            item = new MenuItem();
                            item.setValue("View Group Deals");
                            item.setUrl("/stakeholder/viewProposal.xhtml");
                            submenu.getChildren().add(item);

                            model.addSubmenu(submenu);


     
                //END GENERAL MENU FOR ALL STAKEHOLDER ROOT ADMINS
            
            
            //**********   FOOD STAKEHOLDER MENU
            if (stkhldr.getClass() == StakeholderFood.class) {
                
                submenu = new Submenu();
                submenu.setLabel("Reports");

                item = new MenuItem();
                item.setValue("Generate Summary");
                item.setUrl("/stakeholder/reportmanager.xhtml");
                submenu.getChildren().add(item);

                model.addSubmenu(submenu);

                
                //Outlet management submenu for stakeholders
                submenu = new Submenu();
                submenu.setLabel("Outlets");

                item = new MenuItem();
                item.setValue("Add Outlet");
                item.setUrl("/stakeholder/addoutlet.xhtml");
                submenu.getChildren().add(item);

                item = new MenuItem();
                item.setValue("View All Outlets");
                item.setUrl("/stakeholder/viewoutlets.xhtml");
                submenu.getChildren().add(item);
                
                item = new MenuItem();
                item.setValue("Manage an Outlet");
                item.setUrl("/stakeholder/outletaccess.xhtml");
                submenu.getChildren().add(item);

                model.addSubmenu(submenu);

                //Rewards management submenu for stakeholders
                submenu = new Submenu();
                submenu.setLabel("Loyalty Program");

                item = new MenuItem();
                item.setValue("Loyalty Points Manager");
                item.setUrl("/stakeholder/pointsmanager.xhtml");
                submenu.getChildren().add(item);


                item = new MenuItem();
                item.setValue("Rewards Manager");
                item.setUrl("/stakeholder/rewardsmanager.xhtml");
                submenu.getChildren().add(item);

                model.addSubmenu(submenu);


                //Advertisement management submenu for stakeholders
                submenu = new Submenu();
                submenu.setLabel("Advertisements");

                item = new MenuItem();
                item.setValue("Create Ad");
                item.setUrl("/stakeholder/advertisementmanager.xhtml");
                submenu.getChildren().add(item);
                
                item = new MenuItem();
                item.setValue("View Ad");
                item.setUrl("/stakeholder/viewadvertisement.xhtml");
                submenu.getChildren().add(item);

                model.addSubmenu(submenu);

                //Group Buying item
                submenu = new Submenu();
                submenu.setLabel("Group Deals");

                item = new MenuItem();
                item.setValue("Add Group Deal Item");
                item.setUrl("/stakeholder/addNewProposal.xhtml");
                submenu.getChildren().add(item);

                item = new MenuItem();
                item.setValue("View Existing Group Deal Items");
                item.setUrl("/stakeholder/viewProposal.xhtml");
                submenu.getChildren().add(item);

                model.addSubmenu(submenu);
                
                //TTA
                submenu = new Submenu();
                submenu.setLabel("Analytics");
                
                item = new MenuItem();
                item.setValue("Stakeholder Transaction Analytics");
                item.setUrl("/stakeholder/TTA/home.xhtml");
                submenu.getChildren().add(item);

                model.addSubmenu(submenu);
            }//End stakeholder food rep menu
            //********************************************************************************
            
            
            
            

            //**********   EVENT STAKEHOLDER MENU
            if (stkhldr.getClass() == StakeholderPerformance.class){
                submenu = new Submenu();
                submenu.setLabel("Performance Management");

                item = new MenuItem();
                item.setValue("Add Performance");
                item.setUrl("/stakeholder/addperformance.xhtml");
                submenu.getChildren().add(item);

                item = new MenuItem();
                item.setValue("Delete Performance");
                item.setUrl("/stakeholder/deleteperformance.xhtml");
                submenu.getChildren().add(item);
                 
                item = new MenuItem();
                item.setValue("Modify Performance");
                item.setUrl("/stakeholder/modifyperformance.xhtml");
                submenu.getChildren().add(item);
                
                item = new MenuItem();
                item.setValue("Delete Poster");
                item.setUrl("/stakeholder/deleteposter.xhtml");
                submenu.getChildren().add(item);

                model.addSubmenu(submenu);
                
                submenu = new Submenu();
                submenu.setLabel("Show Management");

                item = new MenuItem();
                item.setValue("Add Show");
                item.setUrl("/stakeholder/addshow.xhtml");
                submenu.getChildren().add(item);

                item = new MenuItem();
                item.setValue("Delete Show");
                item.setUrl("/stakeholder/deleteshow.xhtml");
                submenu.getChildren().add(item);
                
                item = new MenuItem();
                item.setValue("Modify Show");
                item.setUrl("/stakeholder/modifyshow.xhtml");
                submenu.getChildren().add(item);

                model.addSubmenu(submenu);
                
                submenu = new Submenu();
                submenu.setLabel("Area Management");

                item = new MenuItem();
                item.setValue("Add Seating Area");
                item.setUrl("/stakeholder/addarea.xhtml");
                submenu.getChildren().add(item);

                item = new MenuItem();
                item.setValue("Delete Seating Area");
                item.setUrl("/stakeholder/deletearea.xhtml");
                submenu.getChildren().add(item);
                
                item = new MenuItem();
                item.setValue("Modify Seating Area");
                item.setUrl("/stakeholder/modifyarea.xhtml");
                submenu.getChildren().add(item);

                model.addSubmenu(submenu);
            }
            //********************************************************************************
            
            
            
            

        }//End Menu Generation code for representative

        //---------------------------------------------------------------------------------------------------------------------------------------------------------
        //---------------------------------------------------------------------------------------------------------------------------------------------------------



        ////Tx Team User Navigation Links
        if (accountType.compareTo("user") == 0) {

            //General
            submenu.setLabel("General"); //NOTE: the General submenu is used by CM team. When we integrate, just put the menu items under their Generals submenu

            item = new MenuItem();
            item.setValue("View Items");
            item.setUrl("/member/viewitems.xhtml");
            submenu.getChildren().add(item);
            
            item = new MenuItem();
            item.setValue("Reward Offers");
            item.setUrl("/member/rewardoffers.xhtml");
            submenu.getChildren().add(item);
 
            item = new MenuItem();
            item.setValue("Shopping Cart");
            item.setUrl("/member/shoppingcart.xhtml");
            submenu.getChildren().add(item);


            model.addSubmenu(submenu);

            //F&B
            submenu = new Submenu();
            submenu.setLabel("Food & Beverage");
            
            item = new MenuItem();
            item.setValue("FoodSearch Engine");
            item.setUrl("/member/custsearchengine.xhtml");
            submenu.getChildren().add(item);
            
            item = new MenuItem();
            item.setValue("My Reservations");
            item.setUrl("/member/myreservation.xhtml");
            submenu.getChildren().add(item);

            model.addSubmenu(submenu);

            //Event Ticketing
            submenu = new Submenu();
            submenu.setLabel("Performance Events");
            
            item = new MenuItem();
            item.setValue("Current Events");
            item.setUrl("/member/performancemain.xhtml");
            submenu.getChildren().add(item);
            
            item = new MenuItem();
            item.setValue("View My Tickets");
            item.setUrl("/member/viewTickets.xhtml");
            submenu.getChildren().add(item);
            
            model.addSubmenu(submenu);


        }//End Menu Generation code for user

    }
    //END TRANSACTION TEAM CODE
    //===================================================================================================================================
    //===================================================================================================================================
   
}

